Skip to content

Conversation

@AlexeySachkov
Copy link
Contributor

This is a cherry-pick of #19747

ZSTDCompressor holds zstd context as its only data members. The idea behind GetSingletonInstance() method was to re-use these contexts for subsequent compression and decompressions. Re-using context across (de)compression reduces system memory usage.

However, zstd contexts are not meant to be used concurrently, therefore, this PR makes ZSTDCompressor object thread-local, instead of static.
Relevant excerpt from zstd doc
(https://facebook.github.io/zstd/zstd_manual.html):

When decompressing many times,
it is recommended to allocate a context only once,
and re-use it for each successive compression operation.
This will make workload friendlier for system's memory.
Use one context per thread for parallel execution.

`ZSTDCompressor` holds `zstd` context as its only data members. The idea
behind `GetSingletonInstance()` method was to re-use these contexts for
subsequent compression and decompressions. Re-using context across
(de)compression reduces system memory usage.

However, `zstd` contexts are not meant to be used concurrently,
therefore, this PR makes `ZSTDCompressor` object thread-local, instead
of static.
Relevant excerpt from zstd doc
(https://facebook.github.io/zstd/zstd_manual.html):

>   When decompressing many times,
>   it is recommended to allocate a context only once,
>   and re-use it for each successive compression operation.
>   This will make workload friendlier for system's memory.
>   Use one context per thread for parallel execution.
@AlexeySachkov
Copy link
Contributor Author

Unexpectedly Passed Tests (1):
  SYCL :: KernelAndProgram/kernel-bundle-get-kernel-ids.cpp

This is a known XPASS that is disabled on the main sycl branch already to investigate it, I will proceed with merge

@AlexeySachkov AlexeySachkov merged commit bca82b6 into intel:sycl-rel-6_3 Sep 3, 2025
21 of 23 checks passed
@AlexeySachkov AlexeySachkov deleted the private/asachkov/cherry-pick-19747 branch September 4, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants